package com.zmm.weblog.web.controller;

import com.zmm.weblog.common.aspect.ApiOperationLog;
import com.zmm.weblog.common.utils.Response;
import com.zmm.weblog.web.module.vo.article.FindArticleDetailReqVo;
import com.zmm.weblog.web.module.vo.article.FindIndexArticlePageListReqVo;
import com.zmm.weblog.web.service.ArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author:福禄寿
 * @Date:2024/4/26 下午12:33
 * @Des:weblog-springboot
 **/
@RestController
@RequestMapping("/article")
@Slf4j
@Api("文章")
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @PostMapping("/list")
    @ApiOperation(value = "获取首页文章分页数据")
    @ApiOperationLog(description = "获取首页文章分页数据")
    public Response findArticlePageList(@RequestBody FindIndexArticlePageListReqVo findIndexArticlePageListReqVo) {
        return articleService.findArticlePageList(findIndexArticlePageListReqVo);
    }

    @PostMapping("/detail")
    @ApiOperation(value = "获取文章详情")
    @ApiOperationLog(description = "获取文章详情")
    public Response findArticleDetail(@RequestBody FindArticleDetailReqVo findArticleDetailReqVo) {
        return articleService.findArticleDetail(findArticleDetailReqVo);
    }
}
